﻿// Write the Flash Object (HTML)-------------------------------------------
function renderFlashObj(myMovie, myMovieID, myFocus, myBGColor, myWidth, myHeight, myScale, myAlign, mySAlign, myWMode, myVars, myMenu, myDisplay) {
	var openWrapper = "<p><textarea rows=\"20\" name=\"uiOutput\" cols=\"150\">";
	myMovie += "?" + location.search.substring(1,location.search.length); // Adds querystring to flash movie

	var flashString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0\" width=\"" + myWidth + "\" height=\"" + myHeight + "\" id=\"" + myMovieID + "\" align=\"" + myAlign + "\">\n";
	flashString += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n";
	flashString += "<param name=\"movie\" value=\"" + myMovie + "\" />\n";
	flashString += "<param name=\"quality\" value=\"high\" />\n";
	flashString += "<param name=\"wmode\" value=\"" + myWMode + "\" />\n";
	flashString += "<param name=\"bgcolor\" value=\"" + myBGColor + "\" />\n";
	flashString += "<param name=\"scale\" value=\"" + myScale + "\" />\n";
	flashString += "<param name=\"salign\" value=\"" + mySAlign + "\" />\n";
	flashString += "<param name=\"menu\" value=\"" + myMenu + "\" />\n";
	flashString += "<param name=\"FlashVars\" value=\"" + myVars + "\" />\n";
	flashString += "<embed src=\"" + myMovie + "\" quality=\"high\" scale=\""+ myScale + "\" wmode=\"" + myWMode + "\" bgcolor=\""+ myBGColor + "\" width=\"" + myWidth + "\" height=\"" + myHeight + "\" name=\"" + myMovieID + "\" align=\"" + myAlign + "\" salign=\"" + mySAlign + "\" menu=\"" + myMenu + "\" FlashVars=\"" + myVars + "\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n";
	flashString += "</object>\n";

	var closeWrapper = "</textarea></p>";

	var flashObj = (typeof myMovieID=="string")?document.getElementById(myMovieID):myMovieID;
	// Write it!
	if(myDisplay == "true") {
		flashObj.innerHTML  = (openWrapper+flashString+closeWrapper); // Use this to view code
	} else {
		flashObj.innerHTML  = (flashString);  // Use this to display movie
		if(myFocus == "true") {
		    flashObj.focus(); // Use this to bring focus to the movie
		}
	}
}
// Done